﻿<div class="roles"><table>
<tr>
	<th>Улога</th>
	<th>Администратор</th>
	<th>Вести</th>
	<th>Огласна табла</th>
	<th>Активности</th>
	<th>Прашања</th>
	<th>Корисници</th>
	<th>Кадар</th>
	<th>Студии</th>
</tr>

<?php 
	echo form_open('adminUsers/updateRoles');
	$resources = array('admin','news','announcements','activities','questions','users','staff','studies');
	foreach($roles as $role){
		echo "<tr>
				<td>".$role->name."
				<input type='hidden' name='".$role->idRlsPk."' value='".$role->idRlsPk."' />	
			</td>\n";
		$access = explode(',',$role->access);
		foreach($resources as $resource){
			$checked = '';
			if(in_array($resource, $access)) $checked = 'checked';
			echo "<td><input type='checkbox' name='".$resource.$role->idRlsPk."' id='".$resource."' value='".$resource."' ".$checked."/></td>\n";
		}
		echo "</tr>\n";	
	};
	
	echo '<tr><td colspan="8"><input type="submit" name="submit" id="submit" value="Внеси" /></td></tr>';
	
	echo form_close();
?>
</table>
</div>
<h2 class="title">Додади улога</h2>
<div class="roles">
<table>
<tr>
	<th>Улога</th>
	<th>Администратор</th>
	<th>Вести</th>
	<th>Огласна табла</th>
	<th>Активности</th>
	<th>Прашања</th>
	<th>Корисници</th>
	<th>Кадар</th>
	<th>Студии</th>
</tr>
<?php echo form_open('adminUsers/addRole')?>
<tr><td>Име</td><td colspan="7"></td></tr>
<tr>
	<td><input type="text" name="name" id="name" /></td>
	<?php 
		foreach ($resources as $resource){
			echo "<td><input type='checkbox' name='".$resource."' id='".$resource."' value='".$resource."' /></td>\n";
		}
	?>
</tr>
<tr><td><input type="submit" name="submit" id="submit" value="Додади" /></td></tr>
<?php echo form_close(); ?>
</table></div>